package com.sqx.modules.goodsType.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.goodsType.entity.GoodsType;
import com.sqx.modules.goodsType.service.GoodsTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 商品分类-用户端
 * @author wuChang
 * @since 2024-05-30
 */
@RestController
@Api(value = "商品分类-用户端", tags = {"商品分类-用户端"})
@RequestMapping("/app/goodsType/")
public class AppGoodsTypeController {
    @Autowired
    private GoodsTypeService goodsTypeService;


    /**
     * 获取商品分类列表
     */
    @ApiOperation("获取商品分类列表")
    @GetMapping(value = "getAppGoodsTypeList")
    public Result getAppGoodsTypeList(@ApiParam(value ="标签id")Long labelId,
                                      @ApiParam(value ="分类名称")String typeName) {
        return Result.success().put("data", goodsTypeService.getAppGoodsTypeList(labelId,typeName));
    }

    /**
     * 根据名称筛选商品分类
     */
    @ApiOperation("根据名称筛选商品分类")
    @GetMapping(value = "getAppGoodsTypeListByName")
    public Result getAppGoodsTypeListByName(@ApiParam("用户id")Long userId,
                                            @ApiParam(value ="标签id")Long labelId,
                                            @ApiParam(value ="分类名称")String typeName) {
        return Result.success().put("data", goodsTypeService.getAppGoodsTypeListByName(labelId,typeName,userId));
    }


}